# barco/sandboxmoduletree.py

from . import sandboxmodule

class SandboxModuleTree(object):
    
    def __init__(self, src_workspace, bin_workspace):
        self.src_workspace = src_workspace
        self.bin_workspace = bin_workspace        
        self.modules = dict()
        self.stack = list()
        self.src_stack = list()
        return None

    def create_module(self, module):
        if module in self.modules.keys(): return self.modules[module]
        m = sandboxmodule.SandboxModule(module, self.src_workspace, self.bin_workspace)
        self.modules[module] = m
        return m

    def push(self, name):
        if name in self.stack: raise
        self.stack.append(name)
        return None

    def pop(self, name):
        n = self.stack.pop()
        if (name != n): raise
        return None

    def src_push(self, module):
        self.src_stack.append(module)
        return None

    





    def get_src_stack(self):
        return self.src_stack

    def get_bin_stack(self):
        return list()

